<?php

function view_error2($title,$message) {
	view_header_top();
	view_header_bottom();
	?>
		<div class="row">
			<div class="large-12 columns">
				<h1><?php echo $title; ?></h1>
				<p><?php echo $message; ?></p>
			</div>
		</div>
	<?php
	view_footer();
}
function view_error($title,$message) {
?>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<?php echo no_index(); ?>
		<style type="text/css">
			body {
				background-color: #fff;
				margin: 40px;
				font-family: Lucida Grande, Verdana, Sans-serif;
				font-size: 12px;
				color: #000;
			}
			#content {
				border: #999 1px solid;
				background-color: #fff;
				padding: 20px 20px 12px 20px;
			}
			h1 {
				font-weight: normal;
				font-size: 14px;
				color: #990000;
				margin: 0 0 4px 0;
			}
		</style>
		<title><?php echo $title; ?></title>
	</head>
	<body>
		<div id="content">
			<h1><?php echo $title; ?></h1>
			<p><?php echo $message; ?></p>
		</div>
	</body>
</html>
<?php
}

function view_404() {
	view_error2('404 Page Not Found','The page you requested was not found.');
}

function view_header_top() {
	echo '<!DOCTYPE html>
			<!--[if IE 8]> 				 <html class="no-js lt-ie9" lang="en"> <![endif]-->
			<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

			<head>
			  <meta charset="utf-8" />
			  <meta name="viewport" content="width=device-width" />
			  <!--CSS-->
			  <link rel="stylesheet" href="'.STYLE_URL.'normalize.css" />
			  <link rel="stylesheet" href="'.STYLE_URL.'foundation.css" />
			  <link rel="stylesheet" href="'.STYLE_URL.'realita.css" />
			  <link rel="stylesheet" href="'.STYLE_URL.'jquery-ui.css" />
			  <!--link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /-->
			  <!--JS-->
			  <script src="'.SCRIPT_URL.'jquery-1.9.1.js"></script>
			  <script src="'.SCRIPT_URL.'vendor/custom.modernizr.js"></script>
			  <script src="'.SCRIPT_URL.'script.js"></script>
			  <script src="'.SCRIPT_URL.'jquery-ui.js"></script>
			  <!--script src="http://code.jquery.com/jquery-1.9.1.js"></script-->
			  <!--script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script-->
			  <!--script src="'.SCRIPT_URL.'foundation.min.js"></script-->
		';
}

function view_header_bottom() {
	$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	if (strpos($url,'?')>0) $url = substr($url,0,strpos($url,'?'));
    ?>
    </head>
<body>
	<div id="fb-root"></div>
	<script>(function(d, s, id) {
	  var js, fjs = d.getElementsByTagName(s)[0];
	  if (d.getElementById(id)) return;
	  js = d.createElement(s); js.id = id;
	  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=147346958657510";
	  fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));</script>
<!-- Navigation -->
	<div id="navid">
	  <nav class="top-bar">
		<ul class="title-area">
		  <!-- Title Area -->
		  <li class="name">
			<h1>
			  <a href="<?php echo HOME_URL; ?>">
				RealiTA UMKM
			  </a>
			</h1>
		  </li>
		  <li class="toggle-topbar menu-icon"><a href="#"><span>menu</span></a></li>
		</ul>
		<section class="top-bar-section">
		  <!-- Right Nav Section -->
		  <ul class="right">
			<li class="divider"></li>
			<li><a href="<?php echo HOME_URL; ?>">Beranda</a></li>
			<li class="divider"></li>
			<li><a href="<?php echo BLOG_URL; ?>">Blog</a></li>
			<li class="divider"></li>
			<li class="has-dropdown">
			<a href="<?php echo MARKETPLACE_URL; ?>">Marketplace</a>
			  <ul class="dropdown">
				<li><a href="<?php echo MARKETPLACE_URL; ?>fashion">Fashion</a></li>
				<li class="has-dropdown">
				  <a href="<?php echo MARKETPLACE_URL; ?>elektronik" class="">Alat Elektronik</a>
				  <ul class="dropdown">
					<li><a href="<?php echo MARKETPLACE_URL; ?>elektronik/komputer">Komputer-Laptop</a></li>
					<li><a href="<?php echo MARKETPLACE_URL; ?>elektronik/handphone">Handphone-Tablet</a></li>
					<li><a href="<?php echo MARKETPLACE_URL; ?>elektronik/alat">Elektronik</a></li>
				  </ul>
				</li>
				<li><a href="<?php echo MARKETPLACE_URL; ?>kesehatan">Kesehatan &amp; Kecantikan</a></li>
				<li class="has-dropdown">
				  <a href="<?php echo MARKETPLACE_URL; ?>perlengkapan" class="">Perlengkapan</a>
				  <ul class="dropdown">
					<li><a href="<?php echo MARKETPLACE_URL; ?>perlengkapan/rumah">Rumah</a></li>
					<li><a href="<?php echo MARKETPLACE_URL; ?>perlengkapan/kantor">Kantor</a></li>
				  </ul>
				</li>
				<li class="has-dropdown">
				  <a href="<?php echo MARKETPLACE_URL; ?>seni" class="">Kesenian &amp; Kerajinan Tangan</a>
				  <ul class="dropdown">
					<li><a href="<?php echo MARKETPLACE_URL; ?>seni/aksesoris">Aksesoris</a></li>
					<li><a href="<?php echo MARKETPLACE_URL; ?>seni/souvenir">Souvenir</a></li>
					<li><a href="<?php echo MARKETPLACE_URL; ?>seni/koleksi">Koleksi</a></li>
				  </ul>
				</li>
				<li><a href="<?php echo MARKETPLACE_URL; ?>hobi">Hobi &amp; Olahraga</a></li>
				<li><a href="<?php echo MARKETPLACE_URL; ?>kebun">Kebun &amp; Taman</a></li>
				<li><a href="<?php echo MARKETPLACE_URL; ?>makanan">Makanan</a></li>
				<li><a href="<?php echo MARKETPLACE_URL; ?>lain">Lain-lain</a></li>
			  </ul>
			</li>
			<li class="divider"></li>
			<?php
			if (isset($_SESSION['logged'])){
			?>
			<li><a href="<?php echo PROFIL_URL.'keranjang'; ?>">Keranjang <?php
			if (count($_SESSION['keranjang'])>0) echo "(".count($_SESSION['keranjang']).")";?></a></li>
			<li class="divider"></li>
			<li class="has-dropdown">
			  <a href="<?php echo PROFIL_URL."a/".$_SESSION['logged']['id']; ?>">Hallo, <?php echo $_SESSION['logged']['name']; ?></a>
			  <ul class="dropdown">
				<li><a href="<?php echo PROFIL_URL."a/".$_SESSION['logged']['id']; ?>">Profil</a></li>
				<li><a href="<?php echo PROFIL_URL.'transaksi'; ?>">Transaksi</a></li>
				<li><a href="<?php echo HOME_URL."login/out?back=$url"; ?>">Logout</a></li>
			  </ul>
			</li>
			<?php
			}else{
			?>
			<li><a href="<?php
				echo HOME_URL."login?back=$url";
			?>">LOGIN or REGISTER</a></li>
			<?php
			}
			?>
		  </ul>
		</section>
	  </nav>
	  </div>
  <!-- End Top Bar Navigation -->
  <div class="row">
    <div class="large-12 columns">
	<!-- Kotak Utama -->	
	<br /><br /><br /><br />
<?php
}

function view_footer() {
	echo "</div>
	</div>	<!-- Kotak Utama Atas -->
	<!-- Footer -->
      <footer class=\"row\">
        <div class=\"large-12 columns\"><hr>
            <div class=\"row\">
              <div class=\"large-6 columns\">
                  <p>&copy; RealiTA UMKM.</p>
              </div>
              <div class=\"large-6 small-12 columns\">
                  <ul class=\"inline-list right\">
                    <li><a href=\"#\">FB Commerce</a></li>
                    <li><a href=\"#\">FAQ</a></li>
                    <li><a href=\"#\">Kontak</a></li>
                    <li><a href=\"#\">Tentang</a></li>
                  </ul>
              </div>
            </div>
        </div>
      </footer>
    <!-- End Footer -->
    <!-- Kotak Utama -->
    </div>
  </div>
  <script>
	  document.write('<script src=' +
	  ('__proto__' in {} ? '".SCRIPT_URL."vendor/zepto' : '".SCRIPT_URL."vendor/jquery') +
	  '.js><\/script>')
  </script>
</body>
</html>";
}
